<%--
  Created by IntelliJ IDEA.
  User: a'su's
  Date: 2020/9/22
  Time: 19:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>个人资料(经纪人)</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="${path}/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="${path}/plugins/bootstrap-3.3.7-dist/css/bootstrap.css">
    <link rel="stylesheet" href="${path}/css/TenantCentre.css">
    <link rel="stylesheet" href="${path}/css/home.css">

    <style>
        .outer{
            width: 200px;
            height: 200px;
            background-color: #000;
            /*opacity: 0.8;*/
            position:absolute;
        }
    </style>

</head>
<style>
    .gray-bg{
        margin: 0;
        padding: 0;
        font-family: sans-serif;
        background: url(http://${path2}/img/agent.jpg)  no-repeat center 0px;
        background-size: cover;

        background-position: center 0;
        background-repeat: no-repeat;
        background-attachment: fixed;
        -webkit-background-size: cover;
        -o-background-size: cover;
        -moz-background-size: cover;
        -ms-background-size: cover;

    }
</style>
<body class="gray-bg">
<script src="${path}/plugins/jquery-3.4.1.js"></script>
<script src="${path}/plugins/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<script src="${path}/plugins/layui/layui.js"></script>

<%@include file="topB.jsp"%>
<div class="col-md-9 zy5" style="height: 680px">
    <p class="zy51">个人资料</p>
    <p class="zy52"></p>
    <div class="zy53">
        <img src="http://${path2}/img/zy53.png">基本账号资料
    </div><hr>
    <div class="zy54">
        头像:
        <img class="img-circle zy56" id="head" src="http://${path2}/img/${agent.photograph}">
        <button class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal1">修改</button>
        <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="Pic()">&times;</button>
                        <h4 class="modal-title" id="myModalLabel1">更改头像</h4>
                    </div>

                    <div id="Pic">

                    </div>




                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" id="clopic" onclick="clopic()">关闭</button>
                        <button type="button" class="btn btn-primary" onclick="changehead()">提交更改</button>
                    </div>
                </div>
            </div>
        </div>
    </div> <hr>
    <div class="zy54">
        账号:
        ${register.account}
    </div><hr>
    <div class="zy54">
        密码:
        <span id="pwdspan" class="zy56" style="display: none">${register.password}</span>
        <span class="zy56">*****</span>
        <button class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal2">修改</button>
        <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel2">密码更改</h4>
                    </div>
                    &nbsp;修改密码:
                    <input id="pwd" class="zy56" type="password" placeholder="请输入更改的密码&nbsp;(6-8位,字母或者数字)" onblur="pwd1()" onfocus="pwd11()" autocomplete="off">
                    <span style="color: red;display: none" id="pwdspan1">密码格式不对</span>
                    <span id="pwdspan2" style="color: red;display: none">密码与原密码一样</span>
                    <br>
                    &nbsp;确认密码:
                    <input id="pwd2" class="zy56" type="password" placeholder="请再次输入更改的密码" onblur="pwd4()" onfocus="pwd44()" autocomplete="off">
                    <span style="color: red;display: none" id="pwdspan4">密码与上面密码不一致</span>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" onclick="changepwd()" class="btn btn-primary">提交更改</button>
                    </div>
                </div>
            </div>
        </div>
    </div><hr>
<%--    <div class="zy54">--%>
<%--        手机:--%>
<%--        <span id="phonespan" class="zy56">${agent.phone}</span>--%>
<%--        <button class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal3">修改</button>--%>
<%--        <div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">--%>
<%--            <div class="modal-dialog">--%>
<%--                <div class="modal-content">--%>
<%--                    <div class="modal-header">--%>
<%--                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>--%>
<%--                        <h4 class="modal-title" id="myModalLabel3">手机号更改</h4>--%>
<%--                    </div>--%>
<%--                    &nbsp&nbsp&nbsp--%>
<%--                    <input class="zy56" id="phone" type="text" placeholder="请输入更改的手机号">--%>
<%--                    <div class="modal-footer">--%>
<%--                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>--%>
<%--                        <button type="button" onclick="changephone()" data-dismiss="modal" class="btn btn-primary">提交更改</button>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--        </div>--%>
<%--    </div><hr>--%>
<%--    <div class="zy54">--%>
<%--        姓名:--%>
<%--        <span id="namespan" class="zy56">${agent.name}</span>--%>
<%--        <button class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal4">修改</button>--%>
<%--        <div class="modal fade" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">--%>
<%--            <div class="modal-dialog">--%>
<%--                <div class="modal-content">--%>
<%--                    <div class="modal-header">--%>
<%--                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>--%>
<%--                        <h4 class="modal-title" id="myModalLabel4">姓名添加修改</h4>--%>
<%--                    </div>--%>
<%--                    &nbsp&nbsp&nbsp--%>
<%--                    <input class="zy56" id="name" type="text" placeholder="请输入姓名(10个字符以内)">--%>
<%--                    <div class="modal-footer">--%>
<%--                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>--%>
<%--                        <button type="button" onclick="changename()" data-dismiss="modal" class="btn btn-primary">提交</button>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--        </div>--%>
<%--    </div><hr>--%>
<%--    <div class="zy54">--%>
<%--        身份证号:--%>
<%--        <span id="identityspan" class="zy56">${agent.identityCardNumber}</span>--%>
<%--        <button id="hide" class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal5">认证</button>--%>
<%--        <div class="modal fade" id="myModal5" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">--%>
<%--            <div class="modal-dialog">--%>
<%--                <div class="modal-content">--%>
<%--                    <div class="modal-header">--%>
<%--                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>--%>
<%--                        <h4 class="modal-title" id="myModalLabel5">身份认证</h4>--%>
<%--                    </div>--%>
<%--                    &nbsp;&nbsp;&nbsp--%>
<%--                    <input class="zy56" id="identity" type="text" placeholder="请输入身份证号">--%>
<%--                    <div class="modal-footer">--%>
<%--                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>--%>
<%--                        <button type="button" data-dismiss="modal" onclick="insertIdentity()" class="btn btn-primary">提交</button>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--        </div>--%>
<%--    </div><hr>--%>
    <div class="zy54">
        手机:
        <span id="phonespan" class="zy56">${agent.phone}</span>
        <button class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal3">修改</button>
        <div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel3">手机号更改</h4>
                    </div>
                    &nbsp;&nbsp;&nbsp;
                    <input id="phone" class="zy56" style="height: 33px" type="text" placeholder="请输入更改的手机号" onfocus="getfocus()" autocomplete="off">
                    <span style="color: red;display: none" id="ph1">手机号不能为空</span>
                    <br>
                    &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="code" style="height: 33px;width: 100px" placeholder="请输入验证码" onfocus="getfocus2()" autocomplete="off">
                    <button type="button" class="btn btn-info" onclick="getcode();changetext(this)" style="width: 100px">获取验证码</button>
                    <span style="color: red;display: none" id="ph2">手机号格式错误</span>
                    <span style="color: red;display: none" id="ph3">验证码已发送,5分钟内有效</span>
                    <span style="color: red;display: none" id="ph4">短信验证码错误,请重新获取</span>
                    <span style="color: red;display: none" id="ph5">请输入验证码</span>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" id="clo">关闭</button>
                        <button type="button" onclick="changephone()" class="btn btn-primary">提交更改</button>
                    </div>
                </div>
            </div>
        </div>
    </div> <hr>
    <div class="zy54">
        姓名:
        <span id="namespan" class="zy56">${agent.name}</span>
    </div> <hr>
    <div class="zy54">
        身份证号:
        <span id="identityspan"class="zy56">${agent.identityCardNumber}</span>
        <button id="hide" class="btn btn-primary btn-lg zy55" data-toggle="modal" data-target="#myModal5">实名认证</button>
        <div class="modal fade" id="myModal5" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel5">身份认证(<span style="color: red">身份一旦认证就无法更改</span>)</h4>
                    </div>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名:
                    <input class="zy56" id="name" type="text" placeholder="请输入姓名" onfocus="identityA()" autocomplete="off"><br>
                    &nbsp;&nbsp;身份证号:
                    <input class="zy56" id="identity" type="text" placeholder="请输入身份证号" onfocus="identityB()" autocomplete="off">
                    <span style="color: red;display: none" id="identityAB">请输入正确的身份证号</span>
                    <span style="color: red;display: none" id="identityC">姓名与身份证不匹配,请重新认证</span>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" id="clo2">关闭</button>
                        <button type="button" onclick="insertIdentity()" class="btn btn-primary">提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div> <hr>
    <div class="zy54">
        性别:
        <span id="gender"class="zy56"><c:if test="${agent.gender=='true'}">男</c:if><c:if test="${agent.gender=='false'}">女</c:if> </span>
    </div>

    <div class="zy54" id="big">
        经纪人照片:
        <img src="http://${path2}/img/agents.jpg" style="width: 10%;height: 50px">
        执照:
        <img src="http://${path2}/img/zhizhao.jpg" style="width: 10%;height: 50px">
    </div><hr>


<%--    <div class="zy54">--%>
<%--        <span style="float: left">性别:</span>--%>
<%--        <div style="padding-top: 2%">--%>
<%--            <select id='gender' onchange="changegender()" class="form-control zy577">--%>
<%--                <option <c:if test="${agent.gender==true}">selected</c:if>>男</option>--%>
<%--                <option <c:if test="${agent.gender==false}">selected</c:if>>女</option>--%>
<%--            </select>--%>
<%--        </div>--%>
<%--    </div>--%>
</div>

<%@include file="BottomB.jsp"%>

<input type="hidden" id="registerId" value="${register.id}">





<script>
    $(function(){
        $("#Pic").load("/taofang/Agent/Pic");
    })


    layui.use(['upload','element'],function(){
        let upload = layui.upload;//初始化
        let element = layui.element;//初始化进度条
        //拖拽上传
        upload.render({
            elem: '#Pic'
            ,url: '/taofang/Agent/lay' //改成您自己的上传接口
            ,done: function(res){
                layer.msg('上传成功');
                layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', "http://${path2}/img/"+res.data);
            },
            progress: function(n, elem){
                var percent = n + '%' //获取进度百分比
                element.progress('demo', percent); //可配合 layui 进度条元素使用
                //以下系 layui 2.5.6 新增
                // console.log(elem); //得到当前触发的元素 DOM 对象。可通过该元素定义的属性值匹配到对应的进度条。
            }
        });
    })



    function changehead() {
        let head1 = document.getElementById("head1");
        let agentId = $("#agentId").val();
        if(head1.src=="http://${path2}:8888/taofang/Agent/info/"+agentId){
        }else {
            let head = document.getElementById("head");
            let bighead = document.getElementById("bighead");
            let datas = {"agentId": agentId};
            $.post('/taofang/Agent/changepic', datas, function (data) {
                if (data.code == 200) {
                    head.src = "http://${path2}/img/" + data.data;
                    bighead.src = "http://${path2}/img/" + data.data;
                    head1.src=""
                    $("#clopic").click();
                } else {
                    alert("修改失败");
                }
            })
        }
    }

    function clopic() {
        let head1 = document.getElementById("head1");
        let agentId = $("#tenantId").val();
        if(head1.src=="http://${path2}:8888/taofang/Agent/info/"+agentId){
        }else {
            let head11 = head1.src
            let photograph =head11.substring(27);
            let datas = {"photograph":photograph};
            $.post('/taofang/Agent/delpic', datas, function (data) {
                if (data.code == 200) {
                    head1.src="";
                }
            })




        }

    }


    $(function () {
        let identityspan = document.getElementById("identityspan").innerText;
        if (identityspan!=""){
            let hide = document.getElementById("hide").style.display="none";
        }
    })



    $(function(){
        let divs = document.getElementById("big");
        let imgs = divs.getElementsByTagName("img");

        let body = document.getElementsByTagName("body")[0];

        for (let i=0;i<imgs.length;i++) {
            imgs[i].onmouseover=function(){

                //1. 创建一个div
                let div = document.createElement("div");
                div.id="imgDiv";
                div.className="outer";

                //创建一个img标签
                let img = document.createElement("img");
                img.src=this.src;
                img.style.width="400px";
                img.style.height="400px";

                div.style.left=500+"px";
                div.style.top = 400+"px";

                div.appendChild(img);

                body.appendChild(div);
            }

            imgs[i].onmouseout=function(){
                let div = document.getElementById("imgDiv");
                body.removeChild(div);
            }
        }
    })











    function pwd1() {
        let pwd = $("#pwd").val();
        let pwdspan = $("#pwdspan").text();
        let pwdspan2 = document.getElementById("pwdspan2")
        let pwdspan1 = document.getElementById("pwdspan1")
        if (pwd==pwdspan){
            pwdspan2.style.display="inline"
        }
        if (!(/^[a-zA-Z0-9]{6,8}$/).test(pwd) && pwd!=""){
            pwdspan1.style.display="inline"
        }


    }


    function pwd11() {
        let pwdspan2 = document.getElementById("pwdspan2")
        let pwdspan1 = document.getElementById("pwdspan1")
        pwdspan2.style.display="none"
        pwdspan1.style.display="none"
    }


    function pwd4() {
        let pwd = $("#pwd").val();
        let pwd4 = $("#pwd2").val();
        let pwdspan4 = document.getElementById("pwdspan4")
        if (pwd!=pwd4 && pwd4!=""){
            pwdspan4.style.display="inline"
        }
        if (pwd4==""){
            pwd4.style.display="none"
        }

    }


    function pwd44() {
        let pwdspan4 = document.getElementById("pwdspan4")
        pwdspan4.style.display="none"
    }

    function changepwd() {
        let pwd = $("#pwd").val();
        let pwd4 = $("#pwd2").val();
        let pwdspan2 = document.getElementById("pwdspan2")
        let pwdspan1 = document.getElementById("pwdspan1")
        // let pwdspan3 = document.getElementById("pwdspan3")
        let pwdspan4 = document.getElementById("pwdspan4")
        if(  pwdspan2.style.display=="none" &&
            pwdspan1.style.display=="none" && pwdspan4.style.display=="none" && pwd!="" && pwd4!=""){
            let registerId = $("#registerId").val();
            let datas = {"id": registerId, "password": pwd}
            $.post('/taofang/Agent/changepwd', datas, function (data) {
                if (data.code == 200) {
                    alert("修改成功")
                    window.location="/taofang/login/check"
                }else{
                    alert("修改失败")
                }
            })
        }else{
            alert("请输入正确的修改密码")
        }
    }


    // function changephone() {
    //     let phone = $("#phone").val();
    //     let span = $("#phonespan").text();
    //     if (phone!=""){
    //         if(phone==span){
    //             alert("修改的手机号不能和原来手机号一样")
    //         }else {
    //             if ((/^1(3[0-9]|5[0-9]|8[0-9])[0-9]{8}$/).test(phone)) {
    //                 let agentId = $("#agentId").val();
    //                 let datas = {"id": agentId, "phone": phone}
    //                 $.post('/taofang/Agent/changephone', datas, function (data) {
    //                     if (data.code == 200) {
    //                         alert("修改成功")
    //                         let phonespan = document.getElementById("phonespan").innerText = data.data.phone;
    //                     }
    //                 })
    //
    //
    //             } else {
    //                 alert("请输入正确的手机号")
    //             }
    //
    //         }
    //     }else{
    //         alert("修改不能为空")
    //     }
    // }
    //
    //
    //
    //
    //
    //
    //
    // function changename() {
    //     let name = $("#name").val();
    //     let names=$("#namespan").text();
    //     if (name!=""){
    //         if (name==names){
    //             alert("修改的姓名不能和原来姓名一样")
    //         }else {
    //             if (name.length<11) {
    //                 let agentId = $("#agentId").val();
    //                 let datas = {"id": agentId, "name": name}
    //                 $.post('/taofang/Agent/changename', datas, function (data) {
    //                     if (data.code == 200) {
    //                         alert("修改成功")
    //                         let namespan = document.getElementById("namespan").innerText = data.data.name;
    //                     }
    //                 })
    //             }else{
    //                 alert("姓名不能超过10字符")
    //             }
    //         }
    //     }else{
    //         alert("修改不能为空")
    //     }
    // }
    //
    //
    //
    // function changegender() {
    //     let genval = $("#gender").val();
    //     let vals;
    //     if ("男"==genval){
    //         vals = "true";
    //     }else{
    //         vals="false";
    //     }
    //
    //     let agentId = $("#agentId").val();
    //     let datas={"id":agentId,"gender":vals}
    //     $.post('/taofang/Agent/changegender',datas,function (data){
    //         if (data.code==200){
    //             alert("修改成功")
    //         }
    //     })
    // }
    //
    //
    //
    // function insertIdentity() {
    //     let identity = $("#identity").val();
    //     let agentId = $("#agentId").val();
    //     let datas = {"id":agentId,"identity":identity}
    //     if(identity!=""){
    //
    //         if(( /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/)
    //             .test(identity)){
    //             $.post('/taofang/Agent/insertIdentity', datas, function (data) {
    //                 if (data.code == 200) {
    //                     alert("认证成功")
    //                     let identityspan = document.getElementById("identityspan").innerText = data.data.identityCardNumber;
    //                     let hide = document.getElementById("hide").style.display = "none";
    //                 }
    //             })
    //         }else{
    //             alert("请输入正确的身份证号")
    //         }
    //     }else{
    //         alert("修改不能为空")
    //     }
    //
    // }

    function getfocus() {
        let ph1 = document.getElementById("ph1");
        ph1.style.display="none"
        let ph2 = document.getElementById("ph2");
        ph2.style.display="none"

    }

    function getfocus2() {
        let ph5 = document.getElementById("ph5");
        ph5.style.display="none"

    }

    function getcode() {
        let ph3 = document.getElementById("ph3");
        ph3.style.display="none"
        let ph4 = document.getElementById("ph4");
        ph4.style.display="none";
        let ph5 = document.getElementById("ph5");
        ph5.style.display="none"
        let phone = $("#phone").val();
        let span = $("#phonespan").text();
        if (phone==""){
            let ph1 = document.getElementById("ph1");
            ph1.style.display="inline"
        }else if (phone==span){
            alert("修改的手机号不能和原来手机号一样")
        }else if(!(/^1(3[0-9]|5[0-9]|8[0-9])[0-9]{8}$/).test(phone)){
            let ph2 = document.getElementById("ph2");
            ph2.style.display="inline"
        }else{
            let datas = {"phone":phone}
            $.post('/taofang/Agent/GetCode', datas, function (data) {
                if(data.code==200){
                    ph3.style.display="inline"
                }else{
                    alert("今日获取验证码已上限")
                }
            })
        }
    }
    let countdown = 59;
    function changetext(obj) {
        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.innerText="获取验证码";
            countdown = 59;
            return;
        } else {
            obj.setAttribute("disabled", true);
            obj.innerText="重新发送(" + countdown + ")";
            countdown--;
        }

        setTimeout(function () {
            changetext(obj)
        },1000)
    }




    function changephone() {
        let ph1 = document.getElementById("ph1");
        ph1.style.display="none"
        let ph2 = document.getElementById("ph2");
        ph2.style.display="none"
        let ph3 = document.getElementById("ph3");
        ph3.style.display="none"
        let ph4 = document.getElementById("ph4");
        ph4.style.display="none"
        let ph5 = document.getElementById("ph5");
        ph5.style.display="none"
        let phone = $("#phone").val();
        let code = $("#code").val();
        let span = $("#phonespan").text();
        if (phone==""){
            let ph1 = document.getElementById("ph1");
            ph1.style.display="inline"
        }else if(code=="") {
            let ph3 = document.getElementById("ph3");
            ph3.style.display = "none"
            let ph4 = document.getElementById("ph4");
            ph4.style.display = "none";
            let ph5 = document.getElementById("ph5");
            ph5.style.display = "inline"
        }else if(phone==span){
            alert("修改的手机号不能和原来手机号一样");
        }else{
            let agentId = $("#agentId").val();
            let datas = {"id": agentId, "phone": phone,"code":code};
            $.post('/taofang/Agent/changephone', datas, function (data) {
                if (data.code == 200) {
                    alert("修改成功");
                    let phonespan = document.getElementById("phonespan").innerText = data.data.phone;
                    $("#clo").click();
                } else {
                    let ph3 = document.getElementById("ph3");
                    ph3.style.display="none"
                    let ph4 = document.getElementById("ph4");
                    ph4.style.display="inline";
                }
            })
        }

    }




    function identityB() {
        let identityAB = document.getElementById("identityAB");
        identityAB.style.display="none";
        let identityC = document.getElementById("identityC");
        identityC.style.display="none";
    }

    function identityA() {
        let identityC = document.getElementById("identityC");
        identityC.style.display="none";
    }


    function insertIdentity() {
        let identityAB = document.getElementById("identityAB");
        identityAB.style.display="none";
        let identityC = document.getElementById("identityC");
        identityC.style.display="none";
        let name = $("#name").val();
        let identity = $("#identity").val();
        let agentId = $("#agentId").val();
        let datas = {"id":agentId,"name":name,"identity":identity}
        if(identity!="" && name!=""){
            if(( /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/).test(identity)){
                $.post('/taofang/Agent/insertIdentity', datas, function (data) {
                    if (data.code == 200) {
                        alert("认证成功")
                        let namespan = document.getElementById("namespan").innerText = name;
                        let identityspan = document.getElementById("identityspan").innerText = identity;
                        let gender = document.getElementById("gender").innerText = data.data;
                        let hide = document.getElementById("hide").style.display = "none";
                        $("#clo2").click();
                    }else if(data.code==500){
                        let identityC = document.getElementById("identityC");
                        identityC.style.display="inline";
                    }
                })
            }else{
                identityAB.style.display="inline";
            }
        }else{
            alert("请补全信息")
        }

    }

</script>






</body>
</html>
